#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
    int n = 0, m = 0;
    scanf("%d%d", &n, &m);
    long long  arr[200006] = { 0 };
    int i = 0, j = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    for (i = 0; i < m; i++) {
        int find = 0;
        scanf("%d", &find);
        printf("%d\n", arr[find - 1]);
    }
    return 0;
}